package com.monochromebytes.mononet.packet;

/**
 * Interface of an Inbox that stores outgoing packets.
 * 
 * It's up to the implementation if the Outbox accepts the packets it is sending
 * and in which order it will be done.
 * 
 * @author ted
 */
public interface Outbox {

    /**
     * Returns the next packet that is to be sent.
     * 
     * The packet will be removed from this Outbox. It's up to its
     * implementation which packet will be sent.
     * 
     * If there is not packet to sent, this method will return null.
     * 
     * @param packet
     *            The next packet that is to be sent or null if there is no.
     */
    public OutgoingPacket getNextPacket();

    /**
     * Adds a listener to this Outbox.
     * 
     * The listener will be informed about new packets that were added to this
     * Outbox.
     * 
     * @param listener
     *            The listener that will be added.
     */
    public void addOutboxListener(OutboxListener listener);

    /**
     * Removes a listener from this Outbox.
     * 
     * @param listener
     *            The listener that will be removed.
     */
    public void removeOutboxListener(OutboxListener listener);
}
